package org.anderground.editor.gui.view.drawers.editor;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Stroke;

public abstract class AbstractDrawer implements EditorsDrawer {

	protected double scale;
	protected float xTranslate = 0, yTranslate = 0;
	protected boolean showNames;

	public void shift(int dx, int dy) {
		this.xTranslate += dx;
		this.yTranslate += dy;
	}

	// -------------------------------
	private static Stroke stroke;
	private static Color color;
	private static Paint paint;

	public static void saveGrpahicsParam(Graphics g) {
		stroke = ((Graphics2D) g).getStroke();
		color = g.getColor();
		paint = ((Graphics2D) g).getPaint();
	}

	public static void restoreGraphicsParam(Graphics g) {
		((Graphics2D) g).setStroke(stroke);
		g.setColor(color);
		((Graphics2D) g).setPaint(paint);
	}

}
